Function Reference

_ChooseFont

Creates a Font dialog box that enables the user to choose attributes for a logical font.

#include <Misc.au3>
_ChooseFont([$s_FontName = "Courier New"[, $i_size = 10[, $i_colorref = 0[, $i_FontWeight = 0[, $i_Italic= 0[, $i_Underline = [0, $i_Strikethru = 0[, $h_wnd_owner]]]]]]])

 

Parameters

$s_FontName Optional: Default font name
$i_size Optional: pointsize of font
$i_colorref Optional: COLORREF rgbColors
$i_weight Optional: weight of the font (Default 400)
$i_italic Optional: Default 0
$i_underline Optional: Default 0
$i_strikeout Optional: Default 0
$h_wnd_owner Optional: Handle of owner window (Default 0)

 

Return Value

Returns Array, $array[0] contains the number of elements
if error occurs, @error is set

 

Remarks

$array[1] - attributes = BitOr of italic:2, undeline:4, strikeout:8
$array[2] - fontname
$array[3] - font size = point size
$array[4] - font weight = = 0-1000
$array[5] - COLORREF rgbColors
$array[6] - Hex BGR Color
$array[7] - Hex RGB Color

 

Related

 

Example


#include <Misc.au3>

Local $a_font

; Example 1
$a_font = _ChooseFont("Arial", 8)
If (@error) Then
    MsgBox(0, "", "Error _ChooseFont: " & @error)
Else
    MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf

; Example 2
$a_font = _ChooseFont()
If (@error) Then
    MsgBox(0, "", "Error _ChooseFont: " & @error)
    Exit
Else
    MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf

; Example 3
Local $FontName = $a_font[2]
Local $FontSize = $a_font[3]
Local $ColorRef = $a_font[5]
Local $FontWeight = $a_font[4]
Local $Italic = BitAND($a_font[1], 2)
Local $Underline = BitAND($a_font[1], 4)
Local $Strikethru = BitAND($a_font[1], 8)
$a_font = _ChooseFont($FontName, $FontSize, $ColorRef, $FontWeight, $Italic, $Underline, $Strikethru)
If (@error) Then
    MsgBox(0, "", "Error _ChooseFont: " & @error)
Else
    MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf